
const mongoose = require('mongoose');
const _ = require('lodash');
var userService = require('../service/user.service');

module.exports={
    findByUserId:findByUserId
};

/**
 *
 * @param req
 * @param res
 * @param next
 */
function findByUserId(req,res,next){
    var userid = req.params.userid;
    if(_.isEmpty(userid)){
        next(new Error('userid can not be empty'));
    }else {
        userService.findByUserId(userid,function(err,data){
            if(err){
                res.json({result:false,errMsg:'can not find the user'})
            }else {
                res.json({result:true,data:data});
            }
        });
    }
}



